package cn.tedu.jxc.schedule;

import cn.tedu.jxc.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class CacheSchedule {

    @Autowired
    private UserService userService;

    @Scheduled(fixedRate = 5*60*1000)
    public void rebuildUserCache(){
        log.debug("准备重建user的redis缓存...");
        userService.rebuildUserCache();
        log.debug("user的redis缓存重建成功");
    }
}
